import { ApiProperty } from '@nestjs/swagger';
import { ArticleBaseItem } from './article-base.vo';

class SimpleInfo extends ArticleBaseItem {}

class Pagination {
  @ApiProperty({
    description: '总页数',
    example: 1,
  })
  pages: number;

  @ApiProperty({
    description: '当前页数',
    example: 1,
  })
  page: number;

  @ApiProperty({
    description: '每页数量',
    example: 10,
  })
  pageSize: number;

  @ApiProperty({
    description: '总条数',
    example: 1,
  })
  total: number;
}

export class ArticleListVO {
  @ApiProperty({ type: SimpleInfo, isArray: true })
  list: Array<SimpleInfo>;

  @ApiProperty({ type: () => Pagination })
  pagination: Pagination;
}

export class ArticleListResponse {
  @ApiProperty({ description: '状态码', example: 200 })
  code: number;

  @ApiProperty({
    description: '数据',
    type: () => ArticleListVO,
    example: ArticleListVO,
  })
  data: ArticleListVO;

  @ApiProperty({ description: '消息', example: '成功' })
  message: string;
}
